package com.jyniubi.base.exception;

import com.jyniubi.base.result.ResponseEnum;
import lombok.Getter;

/**
 * @author jyzhang
 * 重新包装运行时异常类，因为RuntimeException不能携带额外的参数
 */

@Getter
public class BussinessException extends RuntimeException {
    private Integer code;
    private String msg;
    public BussinessException(Integer code,String msg){
        super(msg);
        this.code = code;
        this.msg = msg;
    }
    public BussinessException(ResponseEnum responseEnum){
        super(responseEnum.getMessage());
        this.code = responseEnum.getCode();
        this.msg = responseEnum.getMessage();
    }
}
